//
//  NSDictionary+log.m
//  TestCrash
//
//  Created by CityDo on 2019/4/19.
//  Copyright © 2019 CityDo. All rights reserved.
//

#import "NSDictionary+log.h"

@implementation NSDictionary (log)

- (NSString *)descriptionWithLocale:(id)locale{
    
    NSString *logStr = @"";
    
    if ([NSJSONSerialization isValidJSONObject:self]) {
        NSError *error;
        NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&error];
        NSString *json = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
        json = [json stringByReplacingOccurrencesOfString:@"\\n" withString:@""];
        json = [json stringByReplacingOccurrencesOfString:@"\\" withString:@""];

        logStr = json;
    }
    
    return logStr;
}

@end
